const enum EnumViewMode {
  quick = "quick", // 包括了viewType 是 stack、mpr3种
  twoD = "2D", //  包括了viewType 是 stack、mpr3种
  normal = "normal" //  包括了viewType 是 mpr3种
}

const enum EnumViewType {
  stack = "stack",
  mpr = "mpr",
  threeD = "3D",
  sag = "sag",
  cor = "cor",
  ax = "ax",
  volume = "volume",
}


interface IOperation {
  type: EnumOpType;
  subType?: EnumRotateSubType | EnumMeasureSubType;
  actionType?: EnumUserActionType;

  x?: number;
  y?: number;
  zoom?: number;
  scroll?: number;
  interval?: number;
  hor_flip?: boolean;
  ver_flip?: boolean;
}

enum EnumUserActionType {
  down = "down",
  move = "move",
  up = "up",
  none = "none",
  drag = "drag",
  click = "click",
}

const enum EnumOpType {
  none = "none",
  pan = "pan",
  zoom = "zoom",
  window = "window",
  rotate = "rotate",
  reset = "reset",
  scroll = "scroll",
  measure = "measure",
  cross = "cross",
  rotate3D = "rotate3D",
  playOrPause = "playOrPause",
  mark = "mark",
  viewSelect = 'viewSelect',
  showSettings = "showSettings",
  export = 'export',
  screenshot = "screenshot",
  syncView = "syncView",
  pseudoColor = "pseudoColor",
}

interface opMsgType {
  viewType: EnumViewType;
  opType: string;
  subOpType?: string;
  actionType?: EnumUserActionType;

  x?: number;
  y?: number;
  zoom?: number;
  scroll?: number;
  interval?: number;
  hor_flip?: boolean;
  ver_flip?: boolean;
}

interface mprImgProvideType {
  sag: string;
  cor: string;
  ax: string;
}

interface aspectType {
  width: number;
  height: number;
}

interface mprImgProvideCenterType {
  sag: number[];
  cor: number[];
  ax: number[];
}



interface loadSingleViewType {
  opType: 'getImg' | 'setSize';
  address?: string;
  size?: aspectType;
  viewId?: string;
  viewType?: EnumViewType;
}

type mprAspectType = {
  [key in EnumViewType]?: aspectType;
};

interface loadImgMprType {
  viewType: EnumViewType;
  opType: "getImg";
  address?: string;
  size?: mprAspectType;
}

interface resizeViewType {
  viewType: EnumViewType;
  opType: "resize";
  size?: aspectType | mprAspectType;
}

interface resetViewType {
  viewType: EnumViewType;
  opType?: "reset";
}

type mprViewPositionType = "left1" | "left2" | "right";

interface windowArrType {
  viewType: EnumViewType;
  imgSrc: string;
  ref: string;
  position: mprViewPositionType;
}

interface msgReceivedType {
  viewType: EnumViewType;
  imgs: mprImgProvideType | string;
  center?: any;
}

const enum EnumPlayOrPauseSubType {
  play = "play",
  pause = "pause",
  next = "next",
  prev = "prev",
  end = "end",
}

const enum EnumRotateSubType {
  rotate90Clockwise = "cw90",
  rotate90CounterClockwise = "ccw90",
  flipX = "flipX",
  flipY = "flipY",
}

const enum EnumMeasureSubType {
  line = "line",
  rect = "rectangle",
  ellipse = "ellipse",
  angle = "angle",
  none = "",
}

const enum EnumResetSubType {
  resetAll= 'resetAll',
}

interface IOpType {
  type: EnumOpType;
  subType: "" | EnumRotateSubType | EnumMeasureSubType | EnumPlayOrPauseSubType | EnumResetSubType;
}


interface IViewOp {
  [key: string]: {
    activeOp: IOpType,
    playSpeed: number,
    disabledOpList:EnumOpType[]
  }
}

export {
  EnumViewType,
  EnumOpType,
  EnumRotateSubType,
  EnumMeasureSubType,
  EnumPlayOrPauseSubType,
  EnumUserActionType,
  EnumResetSubType,
  EnumViewMode
};

export type {
  IOpType,
  IOperation,
  opMsgType,
  mprImgProvideCenterType,
  loadSingleViewType,
  loadImgMprType,
  resizeViewType,
  resetViewType,
  windowArrType,
  msgReceivedType,
  aspectType,
  IViewOp,
};
